package com.duoduo.demo.springnoxml.vo;

import org.springframework.beans.BeanUtils;

import com.duoduo.demo.springnoxml.model.HelpCategory;

/**
 * 帮助分类VO
 * @author chengesheng@kedacom.com
 * @date 2017年10月23日下午3:14:16
 */
public class HelpCategoryVO {

	/** 分类ID */
	private int id;
	/** 帮助名称 */
	private String name;
	/** 所属父分类 */
	private int parentId;
	/** 链接地址 */
	private String url;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getParentId() {
		return parentId;
	}

	public void setParentId(int parentId) {
		this.parentId = parentId;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * Entity 转换为 VO
	 * @param entity
	 * @return
	 */
	public static HelpCategoryVO fromEntity(HelpCategory entity) {
		HelpCategoryVO vo = new HelpCategoryVO();
		BeanUtils.copyProperties(entity, vo);
		return vo;
	}

	/**
	 * VO 转换为 Entity
	 * @param entity
	 * @return
	 */
	public static HelpCategory toEntity(HelpCategoryVO vo) {
		HelpCategory entity = new HelpCategory();
		BeanUtils.copyProperties(vo, entity);
		return entity;
	}
}
